package com.wjx.reservation_service.service.impl;

import com.wjx.reservation_service.dao.RatingDao;
import com.wjx.reservation_service.model.Rating;
import com.wjx.reservation_service.service.IRatingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class IRatingServiceImpl implements IRatingService {
    @Autowired
    private RatingDao ratingDao;
    public List<Rating> queryRatingByServiceId(int serviceId){
        return ratingDao.queryRatingByServiceId(serviceId);
    }
    //根据id更新评分和反馈
    public int updateScoreById(int id,int score,String feedback,String lastUpdatedTime){
        return ratingDao.updateScoreById(id, score, feedback,lastUpdatedTime);
    }
    //根据id删除评价
    public int deleteRatingById(int id){
        return ratingDao.deleteRatingById(id);
    }
    //根据id查询评价
    public Rating queryRatingById(int id){
        return ratingDao.queryRatingById(id);
    }
    //根据预约id查询评价
    public Rating queryRatingByAppointmentId(int appointmentId){
        return ratingDao.queryRatingByAppointmentId(appointmentId);
    }
    //添加评价
    public int addRating(Rating rating){
        return ratingDao.addRating(rating);
    }
    //根据服务id删除评价
    public int deleteRatingByServiceId(int serviceId){
        return ratingDao.deleteRatingByServiceId(serviceId);
    }
    //根据用户id删除评价
    public int deleteRatingByUserId(int userId){
        return ratingDao.deleteRatingByUserId(userId);
    }
    //根据预约id删除评价
    public int deleteRatingByAppointmentId(int appointmentId){
        return ratingDao.deleteRatingByAppointmentId(appointmentId);
    }
    //查询所有评价
    public List<Rating> queryAllRating(){
        return ratingDao.queryAllRating();
    }
    //根据关键词查询评价
    public List<Rating> queryLikeRating(String keyword){
        return ratingDao.queryLikeRating(keyword);
    }
    //根据用户id查询评价
    public List<Rating> queryRatingByUserId(int userId){
        return ratingDao.queryRatingByUserId(userId);
    }
}
